JavaScript
StringtoNumber Method
Syntax
String.toNumber()
Returns
- valuenumber
The value of the string as a number.
Description
Extension to the native string variable to convert a formatted string into a number.
Discussion
The String.toNumber method will use the character stores in A5.d.number.decimal as the decimal place in the formatted string.
Example
var str = '$10.45'; var num1 = Number(str); // num1 = NaN var num2 = str.toNumber(); // num2 = 10.45